package sg.edu.cs5226.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnection {
	
	public DBConnection(String drivername) {
		try {
			Class.forName(drivername);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	
	public Connection getConnection(String url, String user, String pass) {
		Connection conn;
		try {
			conn = DriverManager.getConnection(url, user, pass);
			if (conn != null) return conn;
		} catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
		return null;
	}
}
